package com.xbongbong.saas.domain.dao.competitor;

import com.xbongbong.pro.domain.entity.UpdateDataEntity;
import com.xbongbong.saas.domain.entity.competitor.CompetitorEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @author Dell
 * @version v1.0
 * @date 2022/8/10 15:03
 * @since v1.0
 */
@Repository
@Mapper
public interface CompetitorDao {

    /**
     * 插入数据
     * @param competitor
     * @return: java.lang.Integer
     * @throws:
     */
    Integer insert(CompetitorEntity competitor);

    /**
     * 删除数据
     * @param key
     * @param corpid
     * @return: java.lang.Integer
     * @throws:
     */
    Integer deleteByKey(@Param("key") Long key,@Param("corpid") String corpid);

    /**
     * 更新数据
     * @param competitor
     * @return: java.lang.Integer
     * @throws:
     */
    Integer update(CompetitorEntity competitor);

    /**
     * 根据主键id和公司id获取竞争对手数据
     * @param key
     * @param corpid
     * @return: com.xbongbong.saas.domain.entity.competitor.CompetitorEntity
     * @throws:
     */
    CompetitorEntity getByKey(@Param("key") Long key,@Param("corpid") String corpid);

    Integer updateUpdateTime(@Param("updateTime") Long updateTime, @Param("id") Long id, @Param("corpid") String corpid);

    List<CompetitorEntity> findEntities(@Param("param") Map<String,Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * 批量更新
     * @param list 数据列表
     * @param corpid 公司id
     * @return
     */
    Integer updateBatch(@Param("list") List<UpdateDataEntity> list, @Param("corpid") String corpid);

    /**
     * 批量删除
     * @param corpid
     * @param idIn
     * @return
     */
    Integer deleteByIdIn(@Param("corpid") String corpid, @Param("idIn") List<Long> idIn);
}
